import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;

public class main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		int aadadaf = 0;

		System.out.println("");

		// aaaaaaa

		/*aaaa
		cccc
		dddd*/
		
		/**
		 * asdfasfasd fasdf
		 * 
		 * asdf
		 */

		int a = 7;
		float b = 2;
		
		System.out.println( a/b );
		
		int c = a;
		a = 9;
		System.out.println("a = " + (a++));
		System.out.println("c = " + (++c));
		
		System.out.println( (a++) + c );
		
		//witch
		exSwitch();
		
		//vong lap
		exVonglap();
		
		//
		exTrycatch();
		
		//example mang
		exMang();
		
		//
//		inputChar();
		
		//
		int n = 6;
		boolean kq = ktraSoHoanHao(n);
		
		if (kq==true) {
			System.out.println(n + " la shh");
		}
		else{
			System.out.println( n + " khong la shh");
		}
		
		int arr[] = {6, 5, 10, 8};
		
//		Arrays.sort(arr);
		
		int l = arr.length;
		for (int i = 0; i < l; i++) {
		
			kq = ktraSoHoanHao(arr[i]);
			
			if (kq==true) {
				System.out.println( arr[i] + " la shh" );
			}
			else{
				System.out.println( arr[i] + " khong la shh");
			}
			
		}
		
		
		
	}

	/**
	 * serwewevrwerwerqw
	 * */
	public void name1() {
		
	}
	
	private static void ex() {

	}

	private static void exSwitch(){
		//a{ 6, 12, 16}
		int a = 10;
		switch (a) {
		case 6:
			System.out.println("so be");
			break;
		case 10:
			System.out.println("so lon hon 10");
			break;
		case 15:
			System.out.println("so lon hon 15");
			break;
		default:
			System.out.println("so khac");
			break;
		}
		
	}
	
	private static void exVonglap(){
		for (int i = 0; i < 10; i++) {
			System.out.println("i = " + i);
		}
		
		int j = 0;
		do {
			System.out.println("j = " + j);
			j++;
		} while (j<10);
	}

	private static void exTrycatch(){
		
		try {
			
			int a = 10;
			float b = 0.0f;
			float c = a/b;
			
			System.out.println("c = " + c);
			
		} catch (Exception e) {
			System.out.println("khong the chia dc cho 0");
		}
				
	}
	
	private static void exMang(){
		
		int a[] = new int[10];
		int[] b = {3, 5};
		
		ArrayList<Integer> arr = new ArrayList<Integer>();
		arr.add(10);
		arr.add(20);		
		for (int i = 0; i < arr.size(); i++) {
			System.out.println(arr.get(i));
		}
		
	}
	
	private static void inputChar(){
		
		System.out.println("NHAPTU BAN PHIM");
		
		try {
			
/*			System.out.println("nhap:");
			
			char c = (char) System.in.read();
			
			System.out.println("ki tu vua nhap:" + c);*/
			
			//khong quan tam, nhung khong duoc xoa
			BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
			
			String line;
			
			System.out.println("Nhap so ptu cua mang:");
			line = read.readLine();
			
			//so ptu cua mang
			int n = Integer.parseInt( line ); 
			int i=0;
			int arr[] = new int[n];
			while(i<n){
				
				System.out.println("Nhap gia tri mang thu " + (i + 1) + " :");
				line = read.readLine();
				arr[i] = Integer.parseInt( line );
				
				i++;
			}
			
			//khong quan tam, nhung khong duoc xoa
			read.close();
			
			for (int j = 0; j < n; j++) {
				System.out.println("arr[i] = " + arr[j]);	
			}
						
		} catch (IOException e) {
			System.out.println("nhap sai");
		}
		
	}
	
	private static boolean ktraSoHoanHao(int a){
		
		/*
		 * a = 6
		 * us: 1; 2; 3
		 * */
		int tong = 0;
		for (int i = 1; i < a; i++) {
			
			if (a%i==0) {
				tong += i;
			}
			
		}
		
		if (tong == a) {
			return true;
		}
		
		return false;	
		
	}
		
}
